package com.example.service.medical;

import com.example.model.entity.medical.CountOffice;
import com.example.mapper.medical.CountOfficeMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 预约挂号量科室统计表业务处理
 **/
@Service
public class CountOfficeService {

    @Resource
    private CountOfficeMapper countOfficeMapper;

    /**
     * 新增
     */
    public void add(CountOffice countOffice) {
        countOfficeMapper.insert(countOffice);
    }

    /**
     * 删除
     */
    public void deleteById(Integer id) {
        countOfficeMapper.deleteById(id);
    }

    /**
     * 批量删除
     */
    public void deleteBatch(List<Integer> ids) {
        for (Integer id : ids) {
            countOfficeMapper.deleteById(id);
        }
    }

    /**
     * 修改
     */
    public void updateById(CountOffice countOffice) {
        countOfficeMapper.updateById(countOffice);
    }

    /**
     * 根据ID查询
     */
    public CountOffice selectById(Integer id) {
        return countOfficeMapper.selectById(id);
    }

    /**
     * 查询所有
     */
    public List<CountOffice> selectAll(CountOffice countOffice) {
        return countOfficeMapper.selectAll(countOffice);
    }

    /**
     * 分页查询
     */
    public PageInfo<CountOffice> selectPage(CountOffice countOffice, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<CountOffice> list = countOfficeMapper.selectAll(countOffice);
        return PageInfo.of(list);
    }

}
